<?php
class socket {
	public $host = "";
	public $port = 0;
	public $sock;
	public $connect;
	
	function __construct($h, $p) {
		$this->host = $h;
		$this->port = $p;
	}
	
	function Connect() {
		set_time_limit ( 0 );
		$this->sock = @socket_create ( AF_INET, SOCK_STREAM, SOL_TCP );
		$this->connect = @socket_connect ( $this->sock, $this->host, $this->port );
	}
	
	function send($data) {
		if (@socket_write ( $this->sock, $data ) == false) {
			return;
		}
	}
	
	function read() {
		$str = @socket_read ( $this->sock, 2048 );
		return $str;
	}
	
	function close() {
		@socket_close ( $this->sock );
	}
}

?>